-[ headers, begin ]
	!stdlib !stdio
	extlibs parse putil 
	type
-[ end ]

-[public] enum pfunc_kind { pfunc_user, pfunc_builtin };

-[public] typedef struct pfunc {
	enum pfunc_kind kind;
	char *name;
	linenumber_t *linenumber;
	union {
		utermlist_t *user;
		closure_t *builtin;
	} d;
} pfunc_t;

-[ pflist_t : public list of pfunc_t* ]

-[ callhistory_t : public stack of linenumber_t *]
-[public] callhistory_t *callhistory;
-[ currentfunc_t : public stack of char*]
-[public] currentfunc_t *currentfunc;


-[public] typedef struct {
	char *name;
	type_t  *type;
	void *value;
} variable_t;

-[varlist_t : public list of variable_t* ]

-[public] enum operand_kind 
	{ operand_varref, operand_intconst,
	   operand_utermlist, operand_void , 
	   operand_type };
/* operand_void is simply a cell which holds only code 
    I will later analyse whether I still need operand_utermlist */


-[public] typedef struct {
	enum operand_kind kind;
	union {
		variable_t *varref;
		int intv;
		utermlist_t *termlist;
		type_t *type;
	} d;
	utermlist_t *code;
} operand_t;

-[public] typedef struct {
	int prec;
	int rassoc;
	char *reduction;
} operator_t;

-[ astack_t : public stack of operand_t]
-[ ostack_t : public stack of operator_t]
-[ costack_t : public stack of pflist_t* ]

-[public] typedef struct parser {
	struct parser *parent;
	astack_t *astack;
	ostack_t *ostack;
	int expect_term;
	utermlist_t *body;
	varlist_t *vars;
	costack_t *costack;
} parser_t;

-[public] pflist_t *global_context;
-[public] pflist_t *uglobal_context;

